<?php 
	$conn=@mysqli_connect('localhost','wd1900138','pass123456');
	if($conn==false){
		echo json_encode(['error'=>1,'msg'=>'网络错误，请检查网络连接']);
		exit();
	}
	mysqli_select_db($conn,'wd1900138');
	mysqli_query($conn,'set names utf8');

	if($_POST['act']=='list'){
		$page=$_POST['page'];
		$size=$_POST['size'];
		$start=($page-1)*$size;
		$query=mysqli_query($conn,"select * from gj_xuetang where 1 limit $start,$size");
		while($row=mysqli_fetch_assoc($query)){
			$list[]=$row;
		}
		echo json_encode(['error'=>0,'msg'=>'success','data'=>$list]);
	}
	else if($_POST['act']=='bannerList'){
		$query=mysqli_query($conn,"select * from gj_banner where 1 limit 3");
		while($row=mysqli_fetch_assoc($query)){
			$list[]=$row;
		}
		echo json_encode(['error'=>0,'msg'=>'success','data'=>$list]);
	}
	mysqli_close($conn);
?>